"""
Case Type   : cm_ctl
Case Name   : 查看静态文件中参数event_triggers为空
Create At   : 2023/04/24
Owner       : opentestcase012
Description :
    1.查看静态文件中参数event_triggers为空;
Expect      :
    1.3个值均为空
History     :
"""
import os
import unittest

from testcase.utils.Common import Common
from testcase.utils.CommonSH import CommonSH
from testcase.utils.Logger import Logger
from yat.test import Node
from yat.test import macro

primary_sh = CommonSH('PrimaryDbUser')


@unittest.skipIf(3 != primary_sh.get_node_num(), '非1+2环境不执行')
class DefinedResource(unittest.TestCase):
    def setUp(self):
        self.log = Logger()
        self.log.info(f'----{os.path.basename(__file__)} start----')
        self.primary_sh = primary_sh

    def test_cm(self):
        text = '----step1:查看静态文件中参数event_triggers; expect:3个值均为空----'
        self.log.info(text)
        cm_ctl_res = self.primary_sh.exec_cm_ctl(
            'list', '--param --agent | grep event_triggers')
        self.assertEqual(3, cm_ctl_res.count("event_triggers = {}"),
                         '执行失败:' + text)

    def tearDown(self):
        self.log.info('-----无需清理环境-----')
        self.log.info(f'----{os.path.basename(__file__)} finish----')
